package com.example.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.example.entity.ChatMessage;
import com.example.service.ChatMessageService;
import com.example.mapper.ChatMessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 11988
* @description 针对表【chat_message】的数据库操作Service实现
* @createDate 2025-04-12 17:18:29
*/
@Service
public class ChatMessageServiceImpl extends ServiceImpl<ChatMessageMapper, ChatMessage>
    implements ChatMessageService{
    @Autowired
    private ChatMessageMapper chatMessageMapper;

    @Override
    public List<ChatMessage> ListPage2(Integer pageNo, String pageSize) {
        Integer size = Integer.parseInt(pageSize);
        pageNo = pageNo * size;
        return chatMessageMapper.ListPage(pageNo,size);
    }

    @Override
    public Page<ChatMessage> ListPage(Integer pageNo, String pageSize) {
        Page<ChatMessage> page =  new Page<>();
        return chatMessageMapper.selectPage(page, null);
    }
}




